Fix Bug 897286 - Add Better Pagination for all pages. Refactor controlli...

...ng code into UI module

https://bugzilla.mozilla.org/show_bug.cgi?id=897286