Optional all capture groups in rewrite rule

Ok after 4 hours I managed to make it work

function pl_add_rewrite_rule() {
    // this works with pagination too
    add_rewrite_rule('^slike(\/([a-z]+))?(\/([a-z]+))?(\/page\/([0-9]+))?$','index.php?page_id=45893&carstvo=$matches[2]&kategorija=$matches[4]&paged=$matches[6]','top');

    add_rewrite_tag('%carstvo%','([^/]*)');
    add_rewrite_tag('%kategorija%','([^/]*)');
}
add_action('init', 'pl_add_rewrite_rule', 10, 0);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)