Merge pull request #1209 from SamBrishes/patch-007

Bugfix: Search Plugin will not work if itemsPerPage is set to "All Content"
This commit is contained in:
Diego Najar 2020-06-15 12:16:53 +02:00 committed by GitHub
commit f9c0105168
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,9 +131,15 @@ EOF;
// The first page number is 1, so the real is 0
$realPageNumber = $url->pageNumber() - 1;
$itemsPerPage = $site->itemsPerPage();
$chunks = array_chunk($list, $itemsPerPage);
if (isset($chunks[$realPageNumber])) {
$this->pagesFound = $chunks[$realPageNumber];
if($itemsPerPage <= 0) {
if($realPageNumber === 0) {
$this->pagesFound = $list;
}
} else {
$chunks = array_chunk($list, $itemsPerPage);
if (isset($chunks[$realPageNumber])) {
$this->pagesFound = $chunks[$realPageNumber];
}
}
}
}