<?php
defined('ABSPATH') || exit;

global $wp_query;

if ($wp_query->max_num_pages <= 1) {
    return;
}

$big = 999999999;

$current_page = max(1, get_query_var('paged'));
$total_pages  = $wp_query->max_num_pages;

$pagination = paginate_links(array(
    'base'      => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
    'format'    => '?paged=%#%',
    'current'   => $current_page,
    'total'     => $total_pages,
    'type'      => 'array',
    'prev_text' => '<svg><use xlink:href="#arr_left"></use></svg>',
    'next_text' => '<svg><use xlink:href="#arr_right"></use></svg>',
    'end_size'  => 2, // show 1 page at start & end
    'mid_size'  => 0, // keep it compact
));

if (is_array($pagination)) : ?>
    <nav class="woocommerce-pagination">
        <ul class="page-numbers">
            <?php foreach ($pagination as $page) : ?>
                <li><?php echo $page; ?></li>
            <?php endforeach; ?>
        </ul>
    </nav>
<?php endif; ?>