X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/2b4b34a76f42841e964a549fc64c02ba4f60a3f4..925eaabf42cbbbe2ceac8e1bb95c11ec8be5f375:/www/list.php diff --git a/www/list.php b/www/list.php index a75fda8..911f26d 100644 --- a/www/list.php +++ b/www/list.php @@ -11,28 +11,21 @@ if (isset($_GET['page'])) { if (!is_numeric($_GET['page'])) { throw new Exception_Input('List page is not numeric'); } - $page = (int)$_GET['page']; + $page = (int)$_GET['page'] - 1; } $perPage = 10; -$repos = $rs->getList($page, $perPage); +list($repos, $repoCount) = $rs->getList($page, $perPage); -$links = array('prev' => null, 'next' => null); -if ($page > 0) { - $links['prev'] = '/list/' . ($page - 1); - if ($page - 1 == 0) { - $links['prev'] = '/list'; - } -} -if (count($repos) && count($repos) == $perPage) { - $links['next'] = '/list/' . ($page + 1); -} +$pager = new Html_Pager( + $repoCount, $perPage, $page + 1, '/list/%d' +); render( 'list', array( 'repos' => $repos, - 'links' => $links, + 'pager' => $pager, ) ); ?>