This is a little hard to explain in few words:
- But the paginator is static, so it is created the first time you access it (with .Paginate or .Paginator)
- You are accessing it in the header then changing it later, this does not work
I suggest you look into base templates and blocks and make sure it is created with the params you want before you access it.