Skip to content
Snippets Groups Projects
Commit 96dd4204 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

Fix Pagination::getOffset() and allow percent signs in $condition for loadSORMCollection()

fixes #683
parent 370fce3b
No related branches found
No related tags found
No related merge requests found
......@@ -43,13 +43,13 @@ class Pagination
$this->current_page = $current_page;
$this->per_page = $per_page;
$this->current_page = min(
$this->current_page,
$this->getPageCount() - 1
);
if ($this->current_page < 0) {
$this->current_page = 0;
} else {
$this->current_page = min(
$this->current_page,
$this->getPageCount() - 1
);
}
}
......@@ -206,11 +206,7 @@ class Pagination
throw new RuntimeException('No valid SORM class given');
}
$sql = sprintf(
"{$condition} LIMIT %u, %u",
$this->getOffset(),
$this->getPerPage()
);
$sql = "{$condition} LIMIT {$this->getOffset()}, {$this->getPerPage()}";
return SimpleORMapCollection::createFromArray(
$sorm_class::findBySQL($sql, $parameters)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment