Skip to content

Commit

Permalink
Merge pull request #47 from unfear-underscore/master
Browse files Browse the repository at this point in the history
Update PaginationManager.java
  • Loading branch information
hamza-cskn committed Nov 11, 2023
2 parents 6811e24 + d4be639 commit 3c27729
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,14 @@ public boolean isFirstPage() {
* @return calculates last page's number
*/
public int getLastPage() {
if (this.slots.isEmpty())
if (this.slots.isEmpty() || this.items.isEmpty())
return 0;

int divison = (int) Math.floor(this.items.size() / this.slots.size());
int division = (int) Math.floor(this.items.size() / this.slots.size());

if (this.items.size() % this.slots.size() == 0)
return divison - 1;
return divison;
return division - 1;
return division;
}

/**
Expand Down

0 comments on commit 3c27729

Please sign in to comment.