passing values from functions.php to template

You could get your get_publications functions to return a JSON object with all sorts of information you need.

e.g

function get_publications() {
    // Your query here.

    $data = [
        'html' => $your_html,
        'found_posts' => $query->found_posts,
        'current_post' => $query->current_post,
        'current_page' => $page,
        etc...
    ];

    echo json_encode($data);

}

And then parse that data with your javascript.