prepare pagination for ajax