We're currently migrating our Confluence installation, and I was looking around for resources to provide some basic metrics, eg. the total number of (non-private) pages we are currently hosting. It appears that the simplest way to get this information is simply to connect directly to the database and run a query:
# Get count of all pages in all global spaces (each page is counted as a single version)
select count(*)
from SPACES as A
inner join CONTENT as B
on A.SPACEID = B.SPACEID
where A.SPACETYPE='global'
and B.PREVVER is null
and B.CONTENTTYPE='PAGE'