Clean it up,dry it and remove the rag. Snap another pic.
If the original installer used a 4" over the pipe flange you may can just leave the existing flange in place......solvent weld a new flange inside the 4" pipe at the proper level. The bottom of the flange should be sitting even with the top of the finished floor. Then just fill in the space with some hydraulic fast setting cement. Let it cure for a while and then anchor the flange to the concrete.
Hopefully thats 4" pipe the flange is connected to...it would make the repair much easier.
I do not use extension flanges or spanner flanges.....IMO its a handyman way to make the repair and not very professional. Its a "get me by" or "get me out of here" type repair.