Add if-not-empty check before foreach to prevent PHP warning (#4427)

#### Steps to reproduce the issue
* Enable PHP error reporting in your webserver
* Create an empty Joomla category with no articles
* Access this Joomla category URL in your browser - it should display no articles
* Append ?format=feed&type=rss to this URL

#### Expected result
This should not generate any PHP warning.

#### Actual result
This should generate a PHP warning in either your browser or in your PHP error_log. The problem is that the PHP code loops through a $this->items array without checking whether this array is actually empty or not.

#### Additional comments
GitHub pull request will come right after submitting the issue. The pull request will simply add a if-check around the foreach-loop to prevent the PHP warning.