Debugging Magento product filter counts

A handy place to inject a cheeky “error_log” to show the SQL that fetches the counts shown on product filters:

Mage_CatalogIndex_Model_Resource_Attribute::getCount

public/app/code/core/Mage/CatalogIndex/Model/Resource/Attribute.php:76