Extract duplicate top projects query from stats controller