[ticket/11237] Fix PHP error in acp_prune.php

Also making the code a bit more efficient (removing one SQL query)

http://tracker.phpbb.com/browse/PHPBB3-11237