mirror of https://github.com/kiwix/libkiwix.git
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:
parent
64dc5131c0
commit
41c92cfc3c
|
@ -17,6 +17,9 @@
|
||||||
* MA 02110-1301, USA.
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include "searcher.h"
|
#include "searcher.h"
|
||||||
#include "kiwixlib-resources.h"
|
#include "kiwixlib-resources.h"
|
||||||
#include "reader.h"
|
#include "reader.h"
|
||||||
|
@ -432,7 +435,7 @@ string Searcher::getHtml()
|
||||||
oData["resultRange"] = this->resultCountPerPage;
|
oData["resultRange"] = this->resultCountPerPage;
|
||||||
oData["resultLastPageStart"]
|
oData["resultLastPageStart"]
|
||||||
= this->estimatedResultCount > this->resultCountPerPage
|
= this->estimatedResultCount > this->resultCountPerPage
|
||||||
? this->estimatedResultCount - this->resultCountPerPage
|
? std::round(this->estimatedResultCount / this->resultCountPerPage) * this->resultCountPerPage
|
||||||
: 0;
|
: 0;
|
||||||
oData["protocolPrefix"] = this->protocolPrefix;
|
oData["protocolPrefix"] = this->protocolPrefix;
|
||||||
oData["searchProtocolPrefix"] = this->searchProtocolPrefix;
|
oData["searchProtocolPrefix"] = this->searchProtocolPrefix;
|
||||||
|
|
Loading…
Reference in New Issue