Not sure If I understand it correctly. We exit the while loop either if we have >= 15 results or if no more users are left.

The $limit is there that we don't fetch all users at once (honestly I don't even get the old line at the moment, why do we need to reduce $limit at all?). But with your changes $userlimit equals the number of all available users. So we execute the while exactly once if we found >=15 users and exactly two times if we found < 15 users, the second round we execute the while loop just to discover that there are no more users left to check.

Where is the mistake here? Am I wrong?