The value of $query is used in the actual call to the database and says return that many rows. Permissons are not checked at this point, as it is easier to call the VB function fetch_permissions during the loop. The $limit value acts like a valve so that when the loop has added that many records to the display after passing the perms check, the loop will exit. The reason we have two vars here is that if we simply got the last ten records from he database, and all ten happened to be in a protected forum of sorts, no records would be displayed. There are other scenarios that can occur as well. For you application, your changes are fine, as long as you are aware that if you change your boards perms and no results are found it will still display the header with no rows.
Thanks for the compliment.