if(!\Drupal::service('path.validator')->isValid($custom_path['path'])){//todo: Change to different function, as this also checks if current user has access. The user however varies depending if process was started from the web interface or via cron/drush.
if(!\Drupal::service('path.validator')->isValid($custom_path['path'])){//todo: Change to different function, as this also checks if current user has access. The user however varies depending if process was started from the web interface or via cron/drush. Use getUrlIfValidWithoutAccessCheck()?
'#description'=>$this->t("The maximum number of links one sitemap can hold. If more links are generated than set here, a sitemap index will be created and the links split into several sub-sitemaps.<br/>50 000 links is the maximum Google will parse per sitemap, however it is advisable to set this to a lower number. If left blank, all links will be shown on a single sitemap."),
'#title'=>$this->t('Refresh batch every n links'),
'#min'=>1,
'#description'=>$this->t("During sitemap generation, the batch process will issue a page refresh after n links processed to prevent PHP timeouts and memory exhaustion. Increasing this number will reduce the number of times Drupal has to bootstrap (thus speeding up the generation process), but will require more memory and less strict PHP timeout settings."),
$form_state->setErrorByName('max_links',$this->t("The value of the <em>Maximum links in a sitemap</em> field must be empty, or a positive integer greater than 0."));
$form_state->setErrorByName('batch_process_limit',$this->t("The value of the <em>Refresh batch every n links</em> field must be a positive integer greater than 0."));