In table DocumentStats, field “name” represents the name of a page or of a space.
Let’s say we have a space named SPA.CE
Its WebHome for example is correctly saved as name=’SPA\.CE.WebHome’ (note the “\” to escape the first dot)
But we can have a record where name=’SPA.CE’ that represents the space and not a page
Unfortunately, method getDocumentStatistics, when called with scope ALL_PAGES, performs a query “where name like ‘%.%’” and thus record where name=’SPA.CE’ is incorrectly returned in the result set. In the same way, when scope is ALL_SPACES, the query is “where name not like ‘%.%’” and that record is incorrectly skipped.
Records in DocumentStats should be managed in a different way, maybe using the className field to determine the kind of object they represent (and not being based on the name format)