I have the following figures to work with:
totalItems = 26;
itemsPerPage = 6;
currentItem = 17;
currentPage = ??
Given those figures (or any current item value), how can I determine what the current page is. I think I need to use the modulus function but I can’t fathom out which way to go about it.
Could anyone help please? Thank you
You need the
ceilfunctionIt’s worth pointing out this is assuming 1 based paging (first page is page 1 not page 0) and 1 based item number (meaning page 1 has items 1-6, page 2 has items 7-12).