Using the_posts_pagination with offset adds extra empty page

Thanks to Milo I found something that’s making it work as expected:

Changes made to index.php :

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
 //post content here...
<?php endwhile; endif; ?>

<?php
global $wp_query;

$big = 999999999; // need an unlikely integer
$amount = $wp_query->found_posts;
$totalpages = $amount - (3 - 5);

echo paginate_links( array(
    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    'format' => '?paged=%#%',
    'current' => max( 1, get_query_var('paged') ),
    'total' => $totalpages / 5
) );
?>

So I switched over to paginate_links which lets me set a total number of pages which I could calculate using the found_posts and 3(amount of posts on first page) and 5(amount of posts on paginated pages).

EDIT:

Found another better solution:

function my_offset_pagination( $found_posts, $query ) {
    $ppp = get_option( 'posts_per_page' );
    $first_page_ppp = 3;

    if( $query->is_home() && $query->is_main_query() ) {
        if( !is_paged() ) {

            return( $first_page_ppp + ( $found_posts - $first_page_ppp ) * $first_page_ppp / $ppp );

        } else {

            return( $found_posts - ($first_page_ppp - $ppp) );

        }
    }
    return $found_posts;
}
add_filter( 'found_posts', 'my_offset_pagination', 10, 2 );