A doctor who prescribed more than 2,500 pain pills to Medford pharmacy gunman David Laffer has been arrested on charges of illegally prescribing narcotics to a Queens man who died of an overdose and is being investigated in nine other overdose deaths in the past three years. Dr. Stan Xuhui Li, an anesthesiologist at a New Jersey hospital who operates a pain clinic in Flushing, pleaded not guilty Monday in Manhattan Supreme Court to 15 counts of criminal sale of a prescription for a controlled substance and five counts of reckless endangerment. Li, 57, was arrested at his Flushing clinic Saturday morning, authorities said.