Improve pagination of the gallery pages. No, I will probably never clean up the template code.