Externalize to a function
You could make count a field, then have a function to determineFirstResult().  Then the setPageNumber block can be separated out.

if (pageData.isLastPage()) {
    count = getCountFromDb();
    if (count &gt; 0) {
        boolean isFinalPageFull = (count % maxResults) == 0;
        int pageNum = count / maxResults;
        pageData.setPageNumber((isFinalPage) ? pageNum - 1 : pageNum;
    }
}
firstResult = determineFirstResult();


...

int determineFirstResult(int maxResults) {
    if (pageData.isLastPage()) return getFirstResult(count, maxResults);
    return maxResults * pageNumber;
}


But now you've got a dependency; count has to be determined before calling determineFirstResult() as written.  So maybe make count a lazy-loaded field; if it's requested and null, then (and only then) do you getCountFromDb.