Ticket/12586 Filter files and depth when looking for extensions

https://tracker.phpbb.com/browse/PHPBB3-12586