This is going to show you not only the files but also every version of a file, all files in the trashbin, external files, folders and other ownCloud internal files like for example keys.
I had a quick look in the database and to exclude folders, but include all else you could run
SELECT count(fileid) FROM oc_filecache WHERE mimetype!=2;
To exclude other types of folders the easiest way is the following:
SELECT count(fileid) from oc_filecache WHERE mimetype!=2 AND path NOT LIKE 'files_trashbin%' AND path NOT LIKE 'files_versions%';
You would have to play around a little bit with the output and see what other ownCloud internal folders are still being displayed in your case and exclude them.
A different and rather quick way on the command line would be:
find /path/to/owncloud/data/*/files -type f | wc -l
This should directly only display local files in the filesystem and no versions or trashbin.