mirror of
https://github.com/kiwix/libkiwix.git
synced 2026-10-22 09:05:14 -04:00
RequestContext::get_optional_param()
This commit is contained in:
1 parent
70d42aec98
commit
b60e3ffb26
2 files changed
+11
-8
No files matched your search
@@ -703,14 +703,8 @@ InternalServer::search_catalog(const RequestContext& request,
|
||||
opdsDumper.setTitle("Search result for " + q);
|
||||
std::vector<std::string> bookIdsToDump = mp_library->filter(filter);
|
||||
const auto totalResults = bookIdsToDump.size();
|
||||
size_t count(10);
|
||||
size_t startIndex(0);
|
||||
try {
|
||||
count = extractFromString<unsigned long>(request.get_argument("count"));
|
||||
} catch (...) {}
|
||||
try {
|
||||
startIndex = extractFromString<unsigned long>(request.get_argument("start"));
|
||||
} catch (...) {}
|
||||
const size_t count = request.get_optional_param("count", 10UL);
|
||||
const size_t startIndex = request.get_optional_param("start", 0UL);
|
||||
const auto s = std::min(startIndex, totalResults);
|
||||
bookIdsToDump.erase(bookIdsToDump.begin(), bookIdsToDump.begin()+s);
|
||||
if (count>0 && bookIdsToDump.size() > count) {
|
||||
|
||||
Reference in new issue
Block a user