Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

28 multiple facettes selectable #38

Merged
merged 17 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Classes/Common/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,28 @@ public function setPage(int $page): Paginator
return $this;
}

public function getPagination(): array
public function getTotalPages(): int
{
if (
$this->totalItems < 0 ||
$this->currentPage < 0 ||
$this->itemsPerPage < 0
) {
throw new \Exception('Please specify total items, items per page and current page before retrieving the pagination.');
throw new \Exception('Please specify total items and items per page before retrieving the pagination.');
}

return (int) ceil($this->totalItems / $this->itemsPerPage);
}

public function getPagination(): array
{
if (
$this->currentPage < 0
) {
throw new \Exception('Please specify current page before retrieving the pagination.');
}

$pagination = new Collection();
$totalPages = (int) ceil($this->totalItems / $this->itemsPerPage);
$totalPages = $this->getTotalPages();
$currentPage = $this->currentPage;

$pagesBefore = $this->paginationRange->
Expand Down
Loading
Loading