Update query.php

there was no check for limit. see #4859