fixed example to iterate over pages