Better calculate the start of the last search page.

The increment between pages should always be a multiple of
`resultCountPerPage`.
This commit is contained in:
Matthieu Gautier 2017-11-27 12:39:04 +00:00
parent 64dc5131c0
commit 41c92cfc3c
1 changed files with 4 additions and 1 deletions

View File

@ -17,6 +17,9 @@
* MA 02110-1301, USA.
*/
#include <cmath>
#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;