This looks promising
https://www.sitepoint.com/community/t/getting-the-number-of-rows-that-a-postgresql-select-would-return-without-a-limit-from-a-query-with-a-limit/306558/2?u=mittineague
PostgreSQL: Documentation: 9.1: Value Expressions
the window function is able to scan all the rows that would be part of the current row’s group according to the grouping specification
EDIT
I just had a brief play on my localhost as a POC
SELECT users.username
, COUNT(users.username) OVER ()
FROM users
WHERE users.id > 4
LIMIT 5
