I found this line of code generate wrong SQL
https://github.com/phalcon/cphalcon/blob/1.3.5/ext/paginator/adapter/querybuilder.c#L369
From version 1.3.3 began to have problems
when version 1.3.2 is
SELECT COUNT(*) AS
rowcount
FROMtablename
WHERE ...
since 1.3.3
SELECT COUNT() "rowcount" FROM (SELECT tablename. FROM
tablename
WHERE (...) AS T