Density constraint of the warm absorber in NGC 5548