There seems to be a bug in the "List All Categories" component of 4.0.xx. In 3.9.8.3 when you list all categories, it would properly count all the files in all sub-categories and display the total, but in 4.0.36 and 4.0.38 the total is from what I can tell a random number or sometimes 0. Once you drill into a main category then it seems to count all files in subsequent categories correctly. You can see a demonstration of this on my website here:
https://commodore.software/downloadsIt seems that com_jdownloads/tmpl/category/default.php and /com_jdownloads/tmpl/categories/default.php are summing differently even though they appear to use the $countSubItems function identically.