make pagination generic