From f2c8718586ae96b5ee150110f2a5f507ecb26a53 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 13 Sep 2022 20:03:56 +0200 Subject: [PATCH] keep paginator even if all hits are shown --- out/out.Search.php | 9 +++++---- views/bootstrap/class.Search.php | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/out/out.Search.php b/out/out.Search.php index e46ff76a8..5f138cc95 100644 --- a/out/out.Search.php +++ b/out/out.Search.php @@ -97,7 +97,7 @@ if($fullsearch) { if (is_numeric($_GET["pg"]) && $_GET["pg"]>0) { $pageNumber = (integer)$_GET["pg"]; } - else if (!strcasecmp($_GET["pg"], "all")) { + elseif (!strcasecmp($_GET["pg"], "all")) { $pageNumber = "all"; } } @@ -218,7 +218,7 @@ if($fullsearch) { $dcount = isset($facets['record_type']['document']) ? $facets['record_type']['document'] : 0 ; } } - if($pageNumber != 'all' && $searchresult['count'] > $limit) { + if(/* $pageNumber != 'all' && */$searchresult['count'] > $limit) { $totalPages = (int) ($searchresult['count']/$limit); if($searchresult['count']%$limit) $totalPages++; @@ -527,11 +527,12 @@ if($fullsearch) { } } $totalPages = 1; - if ((!isset($_GET['action']) || $_GET['action'] != 'export') && (!isset($_GET["pg"]) || strcasecmp($_GET["pg"], "all"))) { + if ((!isset($_GET['action']) || $_GET['action'] != 'export') /*&& (!isset($_GET["pg"]) || strcasecmp($_GET["pg"], "all"))*/) { $totalPages = (int) (count($entries)/$limit); if(count($entries)%$limit) $totalPages++; - $entries = array_slice($entries, ($pageNumber-1)*$limit, $limit); + if($pageNumber != 'all') + $entries = array_slice($entries, ($pageNumber-1)*$limit, $limit); } else $totalPages = 1; $facets = array(); diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index a232e4832..8a89bec14 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -936,7 +936,7 @@ function typeahead() { /* {{{ */ } */ echo $this->infoMsg(getMLText("search_report", array("count"=>$total, "doccount" => $totaldocs, "foldercount" => $totalfolders, 'searchtime'=>$searchTime))); - $this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams); + $this->pageList((int) $pageNumber, $totalpages, "../out/out.Search.php", $urlparams); // $this->contentContainerStart(); $txt = $this->callHook('searchListHeader', $orderby, 'asc'); @@ -1048,7 +1048,7 @@ function typeahead() { /* {{{ */ } print "\n"; // $this->contentContainerEnd(); - $this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $_GET); + $this->pageList((int) $pageNumber, $totalpages, "../out/out.Search.php", $_GET); } else { $numResults = $totaldocs + $totalfolders; if ($numResults == 0) {