As I already wrote in my comment 3 days ago something like this should work

    {% paginate craft.entries.section('mySection').limit(10) as pageInfo, pageEntries %}
    
    {% for page, url in pageInfo.getPrevUrls(3) %}
        <a href="{{ url }}">{{ page }}</a>
    {% endfor %}
    
    <span class="current">{{ pageInfo.currentPage }}</span>
    
    {% for page, url in pageInfo.getNextUrls(3) %}
        <a href="{{ url }}">{{ page }}</a>
    {% endfor %}
    
    {% if pageInfo.totalPages - pageInfo.currentPage > 3 %}
        <span>...</span>
    
        <a href="{{ pageInfo.lastUrl }}">{{pageInfo.totalPages}}</a>
    {% endif %}