Pagination with Postgres Database doesn't work

Hello,

in regard to the issues found in #4330 and #4485 the problem still persists in a setup with 3.3.6 and Postgresql 9.0 Database.

One issue is the query resulting from #4330 leaving the databse with an empty result, the other one is that the total number of items for pagination is calculated wrong on the following pages.

Therefore I have attached adaptions to the files legacy.php with _getListCount that solves to problem for Postges, as well in list.php to fix the total results.