I think I have a messy proof which enables me to state for all $m > 2$ being a prime number:
$$ \sum_{k=2}^{m-1} \pi(2k) - m+2 = \pi(m)+2S(m^2) $$
Where $\pi(x)$ is a function which counts the number of primes $\leq x$ and $S(x)$ is the number of odd square free semi primes less $\leq x$. Can you prove the same? (I'll be putting my own proof later). Using prime number theorem I can get bounds for $S(m^2)$ are there better bounds available?
For example
Let $m=3$:
$$\implies \pi(4) -3+2 = 1 = 1 = \pi(3) + 2 S(9) $$
Let $m=5$:
$$\implies \pi(4) + \pi(6) + \pi(8) - 5+2 = 6 = \pi(5) +2 S(25) $$
Let $m=7$:
$$ \implies \pi(4) + \pi(6) +\pi(8) +\pi(10)+\pi(12) - 7+2= 13 = \pi(7) + 2S (49)$$