Knowing the application this code is for, depending on what you are doing with it, I recommend one of
- Getting a reference to the pagination config (if you just need to read it and made a variable for "easy access")
- Cloning the pagination config (if you are creating a page-specific modification to it)
If this were a builder situation, I'd have a different recommendation but since generate_paginatoirs is in the error, I'm assuming this is later in the process.