Modifed pagination to server side