Unable to get paginate_links working with a custom query

This question already has an answer here:

  • How to fix pagination for custom loops?

    4 answers

Solutions Collecting From Web of "Unable to get paginate_links working with a custom query"

Regarding the number of pages displayed, read through the arguments for paginate_links, specifically end_size and mid_size.

As for the 404- The problem is there is no page 3. Whether or not a page returns content or loads the 404 template is based on the results of the main query, not your custom query you run in the template. If this is a page post type, try setting the paged query var instead of page.