|
|
@@ -24,6 +24,12 @@ class Pagination {
|
|
|
$this->itemCount = $item_count;
|
|
|
|
|
|
$this->setTerms(__("%s result"), __("%s results"));
|
|
|
+
|
|
|
+ $page = $_GET["page"] ?? null;
|
|
|
+ $page = (int) $page;
|
|
|
+ if($page > 0) {
|
|
|
+ $this->setPage($page);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public function setItemCount(int $count): bool {
|
|
|
@@ -128,7 +134,9 @@ class Pagination {
|
|
|
$output = "";
|
|
|
|
|
|
// Page count is 1 or less
|
|
|
- if(!$this->requiresPagination()) return "";
|
|
|
+ if(!$this->requiresPagination()) {
|
|
|
+ //return "";
|
|
|
+ }
|
|
|
|
|
|
// Start building output
|
|
|
|
|
|
@@ -148,7 +156,7 @@ class Pagination {
|
|
|
return "<li class=\"{$item_class} active\"><span class=\"page-link\">{$this->getCurrentPage()}</span></li>";
|
|
|
};
|
|
|
|
|
|
- $output .= "<ul class=\"{$container_class}\">";
|
|
|
+ $output .= "<ul class=\"{$container_class} mb-3\">";
|
|
|
|
|
|
if($this->hasPreviousPage()) {
|
|
|
$output .= $get_page_link_html($first_text, 1);
|
|
|
@@ -181,9 +189,16 @@ class Pagination {
|
|
|
|
|
|
$output .= "</ul>";
|
|
|
|
|
|
+
|
|
|
+ $output .= '<div class="mb-3 text-center">' . $this->getText() . ' / ' . $this->getPageText() . '</div>';
|
|
|
+
|
|
|
return $output;
|
|
|
}
|
|
|
|
|
|
+ public function render(): void {
|
|
|
+ echo $this->build();
|
|
|
+ }
|
|
|
+
|
|
|
public function addParameter(string $name, ?string $value) {
|
|
|
if(!$value) return;
|
|
|
$this->parameters[$name] = $value;
|
|
|
@@ -204,4 +219,8 @@ class Pagination {
|
|
|
public function setIsJsHandled(bool $js_handled): void {
|
|
|
$this->isJsHandled = $js_handled;
|
|
|
}
|
|
|
+
|
|
|
+ public function getPageSize(): int {
|
|
|
+ return $this->pageSize;
|
|
|
+ }
|
|
|
}
|