Updated pagecontroller to be able to handle query parameter