Hm, I'm not entirely sure I understand what you're trying to do. Correct me if I'm wrong, but I thinK you're wanting it to take the total number of pictures, divide by the number of pictures to display on each page, and then decide if you're on the last page or not.
If that's the case, the ceil() function would work better for you than round. Even if you have just one more picture to display, you do need another page. However, round() will most likely bring you down to the lower integer, whereas ceil()p will aways bring you to the higher one.
Let me know if that helps.