Moved page number query string parsing into its own function.