Pagination not applied on posts

The pagination isn’t working correctly because it assumes you want to paginate all results. You are simply hiding pages, by which time it’s too late to adjust the pagination.

To fix this, you need to alter the query using the pre_get_posts filter. For example:

function search_only_posts($query) {
    if($query->is_search) {
        $query->set('post_type', 'post');
    }
    return $query;
}

add_filter('pre_get_posts','search_only_posts');

You may need to add various checks like is_admin() or is_main_query() so that you only change the behaviour on the front-end of the site, and not the admin area.