Count total records with limit

Hi, I'm trying to implement a rest server and some of my request have a lot of data.

As I'm using ionic to consume this api, I'm avoiding returning all the dataset on the first fetch, so I implemented a "infinite scroll" that request new data evertyime the page reachs the bottom, basically a pagination.

I need to inform in the app how many records I have in total and array.length in javascript will not help me (since I get the data by pieces).

Also, on Phalcon, when I call count on a ResultSet it return the count of the results on the ResultSet, so, if I apply a limit 0, 50 and count it will return 50.

There's any way to get the total number of records as if I haven't used limit instead of creating 2 queries (1 with the limit the fetch right and another without the limit to do the count)?

Thanks and sorry about the bad english