mirror of https://github.com/kiwix/libkiwix.git
FIXED: Buggy pagination in fulltext result page
This commit is contained in:
parent
864922ab86
commit
d7fd4064ab
|
@ -30,8 +30,7 @@ namespace kiwix {
|
||||||
resultCountPerPage(0),
|
resultCountPerPage(0),
|
||||||
estimatedResultCount(0),
|
estimatedResultCount(0),
|
||||||
resultStart(0),
|
resultStart(0),
|
||||||
resultEnd(0),
|
resultEnd(0)
|
||||||
resultRange(20)
|
|
||||||
{
|
{
|
||||||
template_ct2 = getResourceAsString("results.ct2");
|
template_ct2 = getResourceAsString("results.ct2");
|
||||||
loadICUExternalTables();
|
loadICUExternalTables();
|
||||||
|
@ -159,8 +158,8 @@ namespace kiwix {
|
||||||
CDT pagesCDT(CDT::ARRAY_VAL);
|
CDT pagesCDT(CDT::ARRAY_VAL);
|
||||||
|
|
||||||
unsigned int pageStart = this->resultStart / this->resultCountPerPage >= 5 ? this->resultStart / this->resultCountPerPage - 4 : 0;
|
unsigned int pageStart = this->resultStart / this->resultCountPerPage >= 5 ? this->resultStart / this->resultCountPerPage - 4 : 0;
|
||||||
|
|
||||||
unsigned int pageCount = this->estimatedResultCount / this->resultCountPerPage + 1 - pageStart;
|
unsigned int pageCount = this->estimatedResultCount / this->resultCountPerPage + 1 - pageStart;
|
||||||
|
|
||||||
if (pageCount > 10)
|
if (pageCount > 10)
|
||||||
pageCount = 10;
|
pageCount = 10;
|
||||||
else if (pageCount == 1)
|
else if (pageCount == 1)
|
||||||
|
@ -184,8 +183,8 @@ namespace kiwix {
|
||||||
oData["searchPatternEncoded"] = urlEncode(this->searchPattern);
|
oData["searchPatternEncoded"] = urlEncode(this->searchPattern);
|
||||||
oData["resultStart"] = this->resultStart + 1;
|
oData["resultStart"] = this->resultStart + 1;
|
||||||
oData["resultEnd"] = (this->resultEnd > this->estimatedResultCount ? this->estimatedResultCount : this->resultEnd);
|
oData["resultEnd"] = (this->resultEnd > this->estimatedResultCount ? this->estimatedResultCount : this->resultEnd);
|
||||||
oData["resultRange"] = this->resultRange;
|
oData["resultRange"] = this->resultCountPerPage;
|
||||||
oData["resultLastPageStart"] = this->estimatedResultCount > this->resultRange ? this->estimatedResultCount - this->resultRange : 0;
|
oData["resultLastPageStart"] = this->estimatedResultCount > this->resultCountPerPage ? this->estimatedResultCount - this->resultCountPerPage : 0;
|
||||||
oData["protocolPrefix"] = this->protocolPrefix;
|
oData["protocolPrefix"] = this->protocolPrefix;
|
||||||
oData["searchProtocolPrefix"] = this->searchProtocolPrefix;
|
oData["searchProtocolPrefix"] = this->searchProtocolPrefix;
|
||||||
oData["contentId"] = this->contentHumanReadableId;
|
oData["contentId"] = this->contentHumanReadableId;
|
||||||
|
|
|
@ -87,7 +87,6 @@ namespace kiwix {
|
||||||
unsigned int resultStart;
|
unsigned int resultStart;
|
||||||
unsigned int resultEnd;
|
unsigned int resultEnd;
|
||||||
std::string contentHumanReadableId;
|
std::string contentHumanReadableId;
|
||||||
unsigned int resultRange;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue