$lastPage = ceil($getnumbers / 15);
Say you have 115 comments. 115 / 15 = 7.667. So you'll have 7 pages, and a bit left. By using ceil()
, you round it to above, so 8. The last page would indeed be 8. 7 pages full of 15 comments, with the last page containing (115 - (7 * 15) =) 10 comments.