pagination support for loops