loops over pages until 500