WordPress Pagination with ajax – Dots

You can use “mid_size” to manage number of pages to display in paginate_links() function.
Please check https://developer.wordpress.org/reference/functions/paginate_links/ for pagination options.
Please see example below to use mid_size.

$args = array( 
    'mid_size' => 3, 
    'prev_next' => true, 
    'prev_text' => '« Previous', 
    'next_text' => 'Next »', 
); 

$result = paginate_links($args);