X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/1a8bb56c72ad34cf159e03b97a467e5e35a614c5..256dda0773f9d540ab4b276949b4f98215261828:/www/search.php diff --git a/www/search.php b/www/search.php index aef209f..82b40a7 100644 --- a/www/search.php +++ b/www/search.php @@ -3,10 +3,11 @@ namespace phorkie; /** * Search for a search term */ +$reqWritePermissions = false; require_once 'www-header.php'; if (!isset($_GET['q']) || $_GET['q'] == '') { - header('Location: ' . Tools::fullUrl('/list')); + header('Location: ' . Tools::fullUrl('list')); exit(); } $query = $_GET['q']; @@ -16,19 +17,25 @@ if (isset($_GET['page'])) { if (!is_numeric($_GET['page'])) { throw new Exception_Input('List page is not numeric'); } - $page = (int)$_GET['page']; + //PEAR Pager begins at 1 + $page = (int)$_GET['page'] - 1; } -$perPage = 10; +$perPage = $GLOBALS['phorkie']['cfg']['perPage']; $db = new Database(); $search = $db->getSearch(); $sres = $search->search($query, $page, $perPage); + +$pager = new Html_Pager( + $sres->getResults(), $perPage, $page + 1, $sres->getLink($query) +); render( 'search', array( 'query' => $query, 'sres' => $sres, + 'pager' => $pager ) ); ?>