From 41c92cfc3c2240836d3f4014081626a7e2404024 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 27 Nov 2017 12:39:04 +0000 Subject: [PATCH] Better calculate the start of the last search page. The increment between pages should always be a multiple of `resultCountPerPage`. --- src/searcher.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/searcher.cpp b/src/searcher.cpp index 4010bdc87..c7c6222f3 100644 --- a/src/searcher.cpp +++ b/src/searcher.cpp @@ -17,6 +17,9 @@ * MA 02110-1301, USA. */ + +#include + #include "searcher.h" #include "kiwixlib-resources.h" #include "reader.h" @@ -432,7 +435,7 @@ string Searcher::getHtml() oData["resultRange"] = this->resultCountPerPage; oData["resultLastPageStart"] = this->estimatedResultCount > this->resultCountPerPage - ? this->estimatedResultCount - this->resultCountPerPage + ? std::round(this->estimatedResultCount / this->resultCountPerPage) * this->resultCountPerPage : 0; oData["protocolPrefix"] = this->protocolPrefix; oData["searchProtocolPrefix"] = this->searchProtocolPrefix;