$cats = [];
foreach ( $params['categories'] as $cat ) {
$title = Title::newFromText( $cat );
if ( !$title || $title->getNamespace() != NS_CATEGORY ) {
$cats = [];
foreach ( $params['categories'] as $cat ) {
$title = Title::newFromText( $cat );
if ( !$title || $title->getNamespace() != NS_CATEGORY ) {