[bug][33983] Fixing $query->setLimit. Closes #3945
[imp][33983] Add unit test for $query->setLimit. Closes #3948