dcache-core: fix statistics totals for top, year and month

http://rb.dcache.org/r/5768 attempted to fix an NPE when the the topmost element of the statistics tree had not yet been generated.

The fix applied there, however, changed the loop invariant inadvertently, causing the summary pages to reflect the same stats for all nodes (based on the oldest node).

This patch restores the original invariant and places a guard against the NPE after the loop, where it does not interfere.

Testing:

redeployed, eliminated current total.raw files and index.html files and regenerated html tree from the admin interface, observing correct totals.

Target: master
Request: 2.7
Request: 2.6
Request: 2.2
Patch: http://rb.dcache.org/r/6335
Require-book: no
Require-notes: yes
Bug: http://rt.dcache.org/Ticket/Display.html?id=8147
Acked-by: Gerd

RELEASE NOTES:

Fixes bug in the statistics page which caused the summary tables for top, year and month to report uniformly the data for the oldest date.