prepare pagination of ref pages