Move away from singleton pattern

The Paginator class is not a singleton anymore. Relying on global state is not nice - now the code is more testable and there is some dependency injection too which simplifies usage in different environments.