getCount(); $lastSite = ceil($count / $site_size); $currentSite = HTTP::GET('site') ?? 1; $currentSite = intval($currentSite); #=============================================================================== # Redirect to page create form if no page exists #=============================================================================== if(!$count) { HTTP::redirect(Application::getAdminURL('page/insert.php')); } if($currentSite < 1 or ($currentSite > $lastSite and $lastSite > 0)) { Application::error404(); } #=============================================================================== # Get paginated page list #=============================================================================== $pages = $PageRepository->getPaginated( $site_sort, $site_size, ($currentSite-1) * $site_size ); foreach($pages as $Page) { $User = $UserRepository->find($Page->get('user')); $templates[] = generatePageItemTemplate($Page, $User); } #=============================================================================== # Build document #=============================================================================== $ListTemplate = Template\Factory::build('page/index'); $ListTemplate->set('LIST', [ 'PAGES' => $templates ?? [] ]); $ListTemplate->set('PAGINATION', [ 'THIS' => $currentSite, 'LAST' => $lastSite, 'HTML' => createPaginationTemplate( $currentSite, $lastSite, Application::getAdminURL('page/') ) ]); $MainTemplate = Template\Factory::build('main'); $MainTemplate->set('NAME', $Language->text('title_page_overview', $currentSite)); $MainTemplate->set('HTML', $ListTemplate); echo $MainTemplate;