Skip to content

Commit

Permalink
Merge pull request #38 from slub/28-multiple-facettes-selectable
Browse files Browse the repository at this point in the history
28 multiple facettes selectable
  • Loading branch information
dikastes authored Jan 24, 2025
2 parents 757a7da + fad4282 commit 0f0b648
Show file tree
Hide file tree
Showing 15 changed files with 647 additions and 399 deletions.
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

0 comments on commit 0f0b648

Please sign in to comment.