Better pagination

Support for max pages
![index_html](https://f.cloud.github.com/assets/487468/2225288/b690f478-9a8a-11e3-9fef-a6355e529706.png)