[#1936] Avoid private and deleted datasets on stats plugin

There are a number of metrics displayed that don't take into account if the dataset is private or deleted. The stats plugin code is heavily unmaintained, but it should be all right to plug the main leaks.