Skip to content

Commit

Permalink
fix condition when last page is null but it is known that there is no…
Browse files Browse the repository at this point in the history
… gap to the last page
  • Loading branch information
priyadi committed Mar 31, 2024
1 parent 453cd22 commit 565cd5f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/rekapager-core/src/Pager/Internal/ProximityPager.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,16 @@ public function __construct(
$this->hasHiddenPagesAfter = false;
$this->nextNeighboringPages[] = $this->decorate($secondLastPage);
}

// if no gap to last page and last page is null, then set the last page

if ($hasGapToLastPage === false && $this->lastPage === null) {
$page = array_shift($nextPages);

if ($page !== null) {
$this->lastPage = $this->decorate($page);
}
}
}

public function withProximity(int $proximity): static
Expand Down

0 comments on commit 565cd5f

Please sign in to comment.