[DDC-2794] Arbitrary Join count walkers solution

Possible solution for Arbitrary Join problem in pagination count
walkers:
https://groups.google.com/forum/#!topic/doctrine-user/rpPYCDNKOU8

Added a condition to test query component against  SelectStatement from
clause
The AST doesn't ensure that the array is indexed starting from `0`, so this should probably be `reset($from)`