Walker Class : extract function and wp_list_pages

I ended up running the function twice on itself. That way, once the walker updated the last element, it went back up to the top to update the first.