Improve the query to get top authors so that it doesn't use companies-related tables

Improve the query to get top authors so that it doesn't use the companies-related tables if no filter on companies is used. This allows to work on databases without companies tables when they are not really needed.