bugfix when making pagination links with per_page parameter