diff --git a/src/common/kiwix/searcher.cpp b/src/common/kiwix/searcher.cpp index 52ba64960..1a548ca4e 100644 --- a/src/common/kiwix/searcher.cpp +++ b/src/common/kiwix/searcher.cpp @@ -175,14 +175,18 @@ namespace kiwix { // pages CDT pagesCDT(CDT::ARRAY_VAL); - unsigned int pageCount = this->estimatedResultCount / this->resultCountPerPage + 1; + + unsigned int pageStart = this->resultStart / this->resultCountPerPage >= 5 ? this->resultStart / this->resultCountPerPage - 4 : 0; + + unsigned int pageCount = this->estimatedResultCount / this->resultCountPerPage + 1 - pageStart; if (pageCount > 10) pageCount = 10; else if (pageCount == 1) pageCount = 0; - - for (unsigned int i=0; iresultCountPerPage; page["end"] = (i+1) * this->resultCountPerPage; diff --git a/static/results.tmpl b/static/results.tmpl index 2144530fb..dd5b0b971 100644 --- a/static/results.tmpl +++ b/static/results.tmpl @@ -114,7 +114,7 @@