Event handler

When debugging some event I added an elgg_log statement like below.

When checking the log, it turns out that it runs 4 times, that should not be the case, since the second time it runs the group_name and group_name_new are the same. This is not a functional issue for the code, but definitely a performance one.

Anyone know why this behaviour is ?

elgg_register_event_handler('update', 'group', 'my_new_event');

function my_new_event($event, $type, $params)

    $group_name_new = get_input("name");
    $group_name = $params->name;

    elgg_log('Group var is '. $group_name .' and new group is '. $group_name_new . ' being made ', 'DEBUG');