Fix for a performance issue when getting the total row count when implementing paging. When dealing with about 250.000 rows, it was taking about 30 secs to show one page on the first load. With this modifications it executes almost instantly.

The problem was that the query applying .count() to the current query generated the SQL:

SELECT count(*) AS count_1
FROM ( SELECT ModelView-columns FROM ModelView-table WHERE conditions ) as anon_1;

which made it actually get all the data in the inner query for then counting the rows and returning the amount. With this modification, the generated query is:

SELECT count(*) AS count_1
FROM ModelView-table
WHERE conditions;

that executes instantly.
Merge pull request #198 from brAzzi64/row_count_performance

Fix for performance issue when calculating total row count for paging